<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>美滴滴</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link type="text/css" rel="stylesheet" media="screen" href="__PUBLIC__/app/css/style.css{$JSDEBUG}"/>
    <link type="text/css" rel="stylesheet" media="screen" href="__PUBLIC__/app/css/media.css{$JSDEBUG}"/>
    <script type="text/javascript" src="__PUBLIC__/app/js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
	  $(function(){
		  $('#huoqu').bind('click',function(){
		       $.ajax({
		    	   type:'get',
		    	   url:"{:U('Beautician/sendCode')}",
		    	   success:function(result){
		    			if (result.status == '1') {
		    				abc();
		    			} else {
		    				alert(result.message);
		    				return false;
		    			}
		    	   }
		       });			   
		   });	
	  });
	</script>
    <style>
		body{padding-top: 0px;}
	</style>
</head>
<body style="background:#fff;">
   <form action="{:U('Beautician/confirmResetPassword')}" method="post">
	 	<section>
	      <div class="login">
	        <h1><img src="__PUBLIC__/app/images/loginlogo.png"></h1>
	        <ul>
	          <li>请输入<span>{$mobile}</span>收到的短信验证码</li>
	          <li>
	              <input type="text" name="verify" placeholder="输入您获取到的验证码" class="code">
	          </li>
	          <li>
	              <input type="button" class="submit hclick" id="huoqu" onClick="abc();" value="获取验证码">
	              <div  class="time" style="display:none;"><span>60</span>s重获</div>
	          </li>
	          <li><input type="button" value="提交" class="dllogin"></li>  <!--填写完addClass("addbg")-->
	        </ul>
	      </div> 
		</section>
	</form>
<script>
function abc(){
	$('#huoqu').hide();
	$('.time').show();
	var sec = $(".time span").text();
   	$(".time span").text(--sec);
	if (sec >= 1){
		setTimeout("abc();", 1000);
	}else{
		$('#huoqu').show();
		$('.time').hide().find('span').text('60');
	}
	return false;
}
abc();
$(function () {
	$("input[name='verify']").keyup(function () {
		var code = $('input[name="verify"]').val();
		var reg=/^\d{6}$/;
		if (!reg.test(code)) {
			$('.dllogin').removeClass('addbg');
			return false;
		}
		
		$('.dllogin').addClass('addbg');
	});
	
	var submitUserInfo;
	$(".dllogin").click(function () {
		if (submitUserInfo && submitUserInfo.state() == 'pending') {
			return false;
		}
		
		var form = $('form').get(0);
		submitUserInfo = $.ajax({
			url: form.action,
			data: $(form).serialize(),
			type: 'post',
			dataType: 'json',
			success: function (result) {
				if (result.status == '1') {
					window.location.href = result.redirect;
				} else {
					alert(result.message);
					return false;
				}
			},
			error: function () {
				alert('验证失败，请稍候重试');
			}
		});
		
		return false;
	});
});
</script>
</body>
	
</html>